﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Model;
using System.Data;

namespace DuncanDAL
{
    public class PayCategoryDataService:IDAL<D_PayCategoryObject>
    {
        public const string SQL_SELECT_PayCategory = "select * from D_PayCategory";
        #region IDAL<D_PayCategoryObject> 成员

        public void Create(D_PayCategoryObject obj)
        {
            
        }

        public void Delete(D_PayCategoryObject obj)
        {
            throw new NotImplementedException();
        }

        public void Update(D_PayCategoryObject obj)
        {
            throw new NotImplementedException();
        }

        public IList<D_PayCategoryObject> QueryAll()
        {
            IList<D_PayCategoryObject> list = new List<D_PayCategoryObject>();
            DataTable dtD_PayCategory = new DataTable("D_PayCategory");
            DBHelper.FillData(SQL_SELECT_PayCategory, dtD_PayCategory);
            foreach (DataRow item in dtD_PayCategory.Rows)
            {
                D_PayCategoryObject o = new D_PayCategoryObject();
                o.Data2Object(item);
                list.Add(o);
            }
            return list;
        }

        public D_PayCategoryObject Get(object id)
        {
            return QueryAll().SingleOrDefault(x => x.Db_OID == (int)id);
        }

        #endregion
    }
}
